﻿Public Class FormResultado
    Dim line As Integer

    Private Sub FormResultado_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        FormPrincipal.textArea.SelectionStart = FormPrincipal.textArea.Text.IndexOf(FormPrincipal.textArea.Lines(line))
        FormPrincipal.textArea.SelectionLength = FormPrincipal.textArea.Lines(line).Length
        FormPrincipal.textArea.SelectionBackColor = FormPrincipal.textArea.BackColor
    End Sub
    Private Sub FormResultado_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        RichTextBox.Text = resultScanner.Substring(resultScanner.IndexOf("]") + 1)
        RichTextBoxHiden.Text = resultScanner
    End Sub

    Private Sub btnCerrar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCerrar.Click
        Me.Close()
    End Sub

    Private Sub RichTextBox_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles RichTextBox.MouseClick
        Dim firstcharindex As Integer = RichTextBoxHiden.GetFirstCharIndexOfCurrentLine()
        Dim currentline As Integer = RichTextBoxHiden.GetLineFromCharIndex(firstcharindex)
        Dim currentlinetext As String = RichTextBoxHiden.Lines(currentline)
        Dim a As Integer = currentlinetext.IndexOf("[")
        Dim b As Integer = currentlinetext.IndexOf("]")
        line = currentlinetext.Substring(a + 1, b - 1)
        line = line - 1
        'MsgBox(currentlinetext.Substring(a + 1, b - 1))
        FormPrincipal.textArea.SelectionStart = FormPrincipal.textArea.Text.IndexOf(FormPrincipal.textArea.Lines(line))
        FormPrincipal.textArea.SelectionLength = FormPrincipal.textArea.Lines(line).Length
        FormPrincipal.textArea.SelectionBackColor = Color.Yellow
        'richTextBox1.Select(firstcharindex, currentlinetext.Length);
    End Sub

End Class